﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;

namespace SubSpec
{
    public abstract class TheoryDataProvider : IEnumerable<object[]>
    {
        public IEnumerator<object[]> GetEnumerator()
        {
            return DataSource().GetEnumerator();
        }

        IEnumerator IEnumerable.GetEnumerator()
        {
            return DataSource().GetEnumerator();
        }

        protected abstract IEnumerable<object[]> DataSource();
    }

    public abstract class SingleItemTheoryDataProvider : TheoryDataProvider
    {
        protected override sealed IEnumerable<object[]> DataSource()
        {
            return SingleItemDataSource().Select( x => new[] { x } );
        }

        protected abstract IEnumerable<object> SingleItemDataSource();
    }
}
